package com.haven.webrobotserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.haven.webrobotserver.dao.mybatis.mapper.UserMapper;
import com.haven.webrobotserver.domain.User;
import com.haven.webrobotserver.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    @Autowired(required = false)
    private UserMapper userMapper;

    @Override
    public PageInfo<User> getPageUsersByCondition(Map<String, String> params, int pageSize, int currentPage) {

        PageHelper.startPage(currentPage,pageSize);

        List<User> users = userMapper.getPageUsersByIpAndEmail(params);

        PageInfo<User> pageUsers = new PageInfo<User>(users);
        return pageUsers;
    }
}
